
<script>
import storage from '@/utils/storage'
import login from '@/utils/login'
import { useStore } from "vuex";
let isShare = false
export default {
	onLaunch: async function (options) {
		console.log(options)
		if (options.query.scene) {
			let inviteCode = decodeURIComponent(options.query.scene)
			console.log(inviteCode, 'short_codeshort_codeshort_codeshort_codeshort_code')
			storage.setStorage('inviteCode', inviteCode)
		}
		if (options.query.isShare) {
			isShare = true
		}
		// console.log('App Launch', getCurrentInstance().appContext.config.globalProperties)
		// const { code, data } = await login({ userName: "15235934537", userPwd: "123123qwe" })
		// if (code === 200) {
		// 	storage.setStorage('access_token', data.token)
		// 	storage.setStorage('info', data.user)
		// }

	},
	onShow: async function () {
		console.log('App Show', storage.getStorage('regiterFlag'), '外层')
		if (storage.getStorage('regiterFlag') !== 0) {
			console.log('内层了')
			login({ getOpenId: !isShare }).then(res => {
				let store = useStore()
				if (isShare && res.temporaryFlag === undefined) {
					store.commit('setLoginStatus', true)	
				} else if (isShare && res.temporaryFlag === 1) {
					uni.navigateTo({
						url: '/pages/register/index'
					})
				}
			})
		}
	},
	onHide: function () {
		console.log('App Hide')
	}
}
</script>

<style lang="scss">
@import "/static/style/common.scss";
/* @import "/wxcomponents/vant/common/index.wxss"; */
/*每个页面公共css */
::-webkit-scrollbar {
	display: none;
	width: 0 !important;
	height: 0 !important;
	-webkit-appearance: none;
	background: transparent;
}
</style>
